import requests
from lxml import etree

headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36',
    'Cookie': 'search_passback=91da83bf7b229c4f9b394c5d00000000; ddscreen=2; dest_area=country_id%3D9000%26province_id%3D111%26city_id%20%3D0%26district_id%3D0%26town_id%3D0; __permanent_id=20190808230301550897707313303157103; __visit_id=20190808230301552307658392982904811; __out_refer=; __trace_id=20190808230301553276023242612367897; pos_9_end=1565276581955; ad_ids=2614197%2C2616109%7C%231%2C1; pos_0_start=1565276582383; pos_0_end=1565276582390'
}


def parser_list(url):
    res = requests.get(url,headers=headers)
    parser = etree.HTML(res.text)
    liList = parser.xpath("//ul[@class='bigimg']/li")
    for li in liList:
        title = li.xpath(".//a[@name='itemlist-title']/text()")
        print(title)

def main():
    for x in range(10):
        url = 'http://search.dangdang.com/?key=python&act=input&page_index=%d'%x
        parser_list(url)
        break

if __name__ == '__main__':
    main()

         